#-object tdx-guest,id=tdx0 -machine type=q35,kernel_irqchip=split,confidential-guest-support=tdx0
BUILD:=./build
HD_IMAGE_NAME:= "./boot.img"

.PHONY:clean bochs qemug qemu

all: ${BUILD}/boot/boot.o loader.bin ../kernel/kernel.bin
	$(shell rm -rf ${HD_IMAGE_NAME})
	./run_before.sh
	dd if=${BUILD}/boot/boot.o of=${HD_IMAGE_NAME} bs=512 count=1 conv=notrunc
	sudo ./run_after.sh
	

${BUILD}/boot/%.o: %.asm
	$(shell mkdir -p ${BUILD}/boot)
	nasm $< -o $@

loader.bin:loader.asm
	nasm loader.asm -o loader.bin

qemu_hda:
	qemu -m 4G -boot c -cpu Haswell -smp cores=4,threads=1 -hda ./xxx.img 

#qemu_fda:
#	qemu-system-x86_64 -enable-kvm -kernel ../kernel/kernel.bin -m 4G -boot a -cpu Haswell -smp cores=4,threads=1 -fda ./boot.img -s	
qemu_fda:
	qemu-system-x86_64 -fda /home/liyongfeng/GitProject/LyfLinuxSys/bootloader/boot.img -boot order=a -m 4G -s -S

qemug:
	qemu -m 4G -boot c -cpu Haswell -smp cores=4,threads=1 -hda ./xxx.img -s -S

clean:
	$(shell rm -rf ${BUILD})

bgdb:
	bochs1 -q -f ../bochsrc2.floppy
bochs:
	bochs -q -f ../bochsrc.floppy

qemu: all
	qemu-system-x86_64 -hda ${HD_IMAGE_NAME}